//
//  TXPFragmentDetailPageViewController.m
//  StayAwhile
//
//  Created by dllo on 16/2/26.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "TXPFragmentDetailPageViewController.h"
#import "TXPFragmentDetailPageView.h"
#import "UMSocial.h"
@interface TXPFragmentDetailPageViewController ()

@property (nonatomic, retain) UIButton *collectBtn;
@property (nonatomic, retain) TXPFragmentDetailPageView *fragmentDetailPageView;
@end

@implementation TXPFragmentDetailPageViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    UIImage *returnImage = [UIImage imageNamed:@"iconfont-fanhui-3.png"];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:returnImage style:UIBarButtonItemStylePlain target:self action:@selector(returnHomePage:)];
    [self.navigationItem.leftBarButtonItem setImage:[returnImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
    
    
    UIImage *collectImage = [[UIImage imageNamed:@"weishoucang.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    UIImage *shareImage = [[UIImage imageNamed:@"iconfont-gengduo.png"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
     UIBarButtonItem *barCollectBtn = [[UIBarButtonItem alloc] initWithImage:collectImage style:UIBarButtonItemStylePlain target:self action:@selector(collectBtnAction:)];
    
    UIBarButtonItem *barShareBtn = [[UIBarButtonItem alloc] initWithImage:shareImage style:UIBarButtonItemStylePlain target:self action:@selector(shareBtnAction:)];
   
    
    NSArray *rightBtns = [NSArray arrayWithObjects:barShareBtn,barCollectBtn, nil];
    self.navigationItem.rightBarButtonItems = rightBtns;
    
    
    self.fragmentDetailPageView = [[TXPFragmentDetailPageView alloc] initWithFrame:CGRectMake(0, 69, WIDTH, HEIGHT)];
    [self.view addSubview:self.fragmentDetailPageView];
    self.fragmentDetailPageView.fragmentModel = self.fragmentmodel;
    
    
}

- (void)shareBtnAction:(UIBarButtonItem *)shareBtn{
    [UMSocialSnsService presentSnsIconSheetView:self appKey:@"558936d367e58eb81b001298" shareText:_fragmentmodel.content shareImage:_fragmentmodel.coverimg shareToSnsNames:nil delegate:nil];

}

- (void)collectBtnAction:(UIBarButtonItem *)collectBtn{
    
}
- (void)returnHomePage:(UIBarButtonItem *)returnBtn{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
